Get the First Row of Pandas using at[]

This function takes column names along with a first-row index to display the first row of the Dataframe. Here, we will see the program to get the first row of the dataset.

Python3




# import pandas module
import pandas as pd
 
# get first row using iat() function of
# first row 2 nd column
print(data.at[0, 'name'])
 
# get first row using iat() function of
# first row 1 st column
print(data.at[0, 'id'])
 
# get first row using iat() function of
# first row 3 rd column
print(data.at[0, 'subjects'])


Output:

sravan
7058
java


How to Get First Row of Pandas DataFrame?

In this article, we will discuss how to get the first row of the Pandas Dataframe

Similar Reads

Get the First Row of Pandas using iloc[]

This method is used to access the row by using row numbers. We can get the first row by using 0 indexes....

Get the First Row of Pandas using head()

...

Get the First Row of Pandas using loc()

...

Get the First Row of Pandas using values()

This function will default return the first 5 rows of the Dataframe. to get only the first row we have to specify 1...

Get the First Row of Pandas using iat[]

...

Get the First Row of Pandas using at[]

...